home *** CD-ROM | disk | FTP | other *** search
/ Teach Your Children: Road Construction Ahead / Teach Your Children: Road Construction Ahead.iso / pc / rca / road.dxr / 00013_VTL Parent.ls < prev    next >
Encoding:
Text File  |  1996-07-17  |  12.7 KB  |  452 lines

  1. property videoList, currentItem, leftPointer, rightPointer, scrollLeftRegion, scrollRightRegion, timeline, gameButChan, booleanList, hiliteChan, signPathList, signChan, butWidth, tool, toolList, firstHatChan, activeAreaChan, cropMarksChan, hatChan, animList, animChan, gameButBmap, nameSoundList, gameIntroSound
  2. global gActorList, gHiddenActorList, gMenuObject, gQTViewerObject, gUserObject, gVTLgameObject, gVTLobject, gRollAnimButton, gCustomCursor, gAlbumObject, gCDpath, gHardHatObject, gFileSep, gErrorTrapFlag
  3.  
  4. on birth me
  5.   set videoList to ["0811.MOV", "0812.MOV", "0813.MOV", "0814.MOV", "0815.MOV", "0816.MOV", "0817.MOV", "0818.MOV", "0819.MOV"]
  6.   set animList to [[21, 2], [16, 2], [12, 4], [19, 3], [11, 2, 1], [20, 2], [14, 3], [15, 2, 1], [27, 2]]
  7.   set booleanList to [0, 0, 0, 0, 0, 0, 0, 0, 0]
  8.   set scrollLeftRegion to 4
  9.   set scrollRightRegion to 5
  10.   set timeline to 2
  11.   set hiliteChan to 45
  12.   set gameButChan to 32
  13.   set gameButBmap to the number of cast "VTLgameButton1"
  14.   set firstHatChan to 15
  15.   set activeAreaChan to 1
  16.   set cropMarksChan to 19
  17.   set animChan to 21
  18.   set currentItem to 1
  19.   set leftPointer to the number of cast "LeftPointer"
  20.   set rightPointer to the number of cast "RightPointer"
  21.   set signPathList to [1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 4, 4, 4, 4, 3, 3, 2, 2, 2, 1, 1, 1, 1]
  22.   set signChan to 13
  23.   set nameSoundList to ["A811N", "A812N", "A813N", "A814N", "A815N", "A816N", "A817N", "A818N", "A819N"]
  24.   set butWidth to 45
  25.   set toolList to [#Tv: [0, the number of cast "VTLtvCursor"], #camera: [0, the number of cast "VTLcamCursor"]]
  26.   set tool to #None
  27.   set gameIntroSound to "RCA819HA"
  28.   return me
  29. end
  30.  
  31. on update me
  32.   if objectp(gCustomCursor) and (tool = #camera) then
  33.     if rollOver(activeAreaChan) then
  34.       set the locH of sprite cropMarksChan to the locH of sprite activeAreaChan + 148
  35.       set the locV of sprite cropMarksChan to the locV of sprite activeAreaChan + 100
  36.     else
  37.       set the locH of sprite cropMarksChan to -1000
  38.     end if
  39.   else
  40.     if (rollOver(scrollLeftRegion) and (currentItem > 1)) or (rollOver(timeline) and (the mouseH < the left of sprite hiliteChan)) then
  41.       cursor(200)
  42.       trackMouse(me)
  43.       set the castNum of sprite 48 to leftPointer
  44.       puppetTempo(60)
  45.     else
  46.       if (rollOver(scrollRightRegion) and (currentItem < 9)) or (rollOver(timeline) and (the mouseH > the right of sprite hiliteChan)) then
  47.         cursor(200)
  48.         trackMouse(me)
  49.         set the castNum of sprite 48 to rightPointer
  50.         puppetTempo(60)
  51.       else
  52.         removeSprite(48)
  53.         cursor(-1)
  54.       end if
  55.     end if
  56.   end if
  57. end
  58.  
  59. on trackMouse me
  60.   set the locH of sprite 48 to the mouseH
  61.   set the locV of sprite 48 to the mouseV
  62. end
  63.  
  64. on setup me
  65.   puppetPalette(0)
  66.   add(gActorList, me)
  67.   set tvButton to birth(script "Rollover Anim Button Class", "activateTool( gVTLObject, #Tv )", 30, 30, 3, "A713VO45", "A713RO45")
  68.   set the soundWait of tvButton to 0
  69.   setAt(getProp(toolList, #Tv), 1, tvButton)
  70.   set cameraButton to birth(script "Rollover Anim Button Class", "activateTool( gVTLObject, #Camera )", 31, 31, 5, "A7VO41", "A7RO41")
  71.   set the soundWait of cameraButton to 0
  72.   setAt(getProp(toolList, #camera), 1, cameraButton)
  73.   repeat with x = 1 to count(toolList)
  74.     set toolData to getAt(toolList, x)
  75.     set toolButObj to getAt(toolData, 1)
  76.     add(gActorList, toolButObj)
  77.   end repeat
  78.   add(gActorList, birth(script "Rollover Anim Button Class", "goMenu( gVTLObject, me )", 27, 27, 5, "RCA-07VO01", "RCA-07RO01"))
  79.   add(gActorList, birth(script "Rollover Anim Button Class", "help( gVTLObject, me )", 28, 28, 11, EMPTY, "RCA-05RO02"))
  80.   add(gActorList, birth(script "Rollover Anim Button Class", "goVTLgame( gVTLgameObject )", gameButChan, gameButChan, 3, "08VO03", "08RO03"))
  81.   puppetSprite(signChan, 1)
  82.   puppetSprite(cropMarksChan, 1)
  83.   puppetSprite(gameButChan, 1)
  84.   puppetSprite(48, 1)
  85. end
  86.  
  87. on predraw me
  88.   if the enabled of gVTLgameObject then
  89.     showVTLgameButton(me)
  90.     puppetSprite(gameButChan, 1)
  91.   end if
  92. end
  93.  
  94. on showVTLgameButton me
  95.   set the locH of sprite gameButChan to 48
  96.   set the locV of sprite gameButChan to 426
  97.   set the castNum of sprite gameButChan to gameButBmap
  98. end
  99.  
  100. on timeLineClick me
  101.   startBuffering()
  102.   if objectp(gCustomCursor) then
  103.     resetTool(me)
  104.   else
  105.     if not objectp(gRollAnimButton) then
  106.       set choice to buttonBarHandler(#Horizontal, 9, butWidth, 0)
  107.       if the mouseH < the left of sprite hiliteChan then
  108.         if choice <> 0 then
  109.           if the enabled of gVTLgameObject = 1 then
  110.             if choice = (currentItem - 1) then
  111.               scrollLeft(me)
  112.             else
  113.               sayNumber(me, choice)
  114.               skipSelection(me, choice)
  115.             end if
  116.           else
  117.             scrollLeft(me)
  118.           end if
  119.         end if
  120.       else
  121.         if the mouseH > the right of sprite hiliteChan then
  122.           if choice <> 0 then
  123.             if the enabled of gVTLgameObject = 1 then
  124.               if choice = (currentItem + 1) then
  125.                 scrollRight(me)
  126.               else
  127.                 sayNumber(me, choice)
  128.                 skipSelection(me, choice)
  129.               end if
  130.             else
  131.               scrollRight(me)
  132.             end if
  133.           end if
  134.         end if
  135.       end if
  136.       repeat while soundBusy(1)
  137.       end repeat
  138.       puppetSound(0)
  139.     end if
  140.   end if
  141.   flushBuffer()
  142. end
  143.  
  144. on sayNumber me, whichNumber
  145.   puppetSound(string(whichNumber) & "th")
  146. end
  147.  
  148. on skipSelection me, choice
  149.   wasVideoSeen(me)
  150.   predraw(me)
  151.   set currentItem to choice
  152.   moveSign(me, #Up)
  153.   cursor(-1)
  154.   removeSprite(48)
  155.   removeHardHat(me)
  156.   puppetTransition(51, 1)
  157.   go("VTL" & string(choice))
  158.   puppetSound(getAt(nameSoundList, currentItem))
  159.   moveSign(me, #down)
  160.   drawHardHat(me)
  161.   repeat while soundBusy(1)
  162.   end repeat
  163.   puppetSound(0)
  164. end
  165.  
  166. on changeHilite me, delta
  167.   set the locH of sprite hiliteChan to the locH of sprite hiliteChan + (delta * butWidth)
  168. end
  169.  
  170. on drawHardHat me
  171.   if the howManyHats of gHardHatObject < 100 then
  172.     set hatChan to firstHatChan - 1 + random(3)
  173.     set the locH of sprite hatChan to the locH of sprite hatChan + 1000
  174.     puppetSprite(hatChan, 1)
  175.     puppetTransition(51, 1)
  176.     updateStage()
  177.   end if
  178. end
  179.  
  180. on removeHardHat me
  181.   set the locH of sprite hatChan to -1000
  182.   puppetSprite(hatChan, 0)
  183. end
  184.  
  185. on globalButtonClick me
  186.   if objectp(gCustomCursor) then
  187.     resetTool(me)
  188.   else
  189.     if objectp(gRollAnimButton) then
  190.       click(gRollAnimButton)
  191.     end if
  192.   end if
  193. end
  194.  
  195. on resetTool me
  196.   set toolType to the type of gCustomCursor
  197.   set toolData to getProp(toolList, toolType)
  198.   set toolButtonObject to getAt(toolData, 1)
  199.   resetBitmap(toolButtonObject)
  200.   showAllActors()
  201.   dispose(gCustomCursor)
  202.   set tool to #None
  203. end
  204.  
  205. on activateTool me, toolSymbol
  206.   startBuffering()
  207.   set toolData to getProp(toolList, toolSymbol)
  208.   set toolButtonObject to getAt(toolData, 1)
  209.   if objectp(gCustomCursor) then
  210.     resetBitmap(toolButtonObject)
  211.     set tool to #None
  212.     dispose(gCustomCursor)
  213.     showAllActors()
  214.   else
  215.     hideActor(toolButtonObject)
  216.     set toolCursor to getAt(toolData, 2)
  217.     select(toolButtonObject)
  218.     birth(script "ColorCursor Class", toolCursor, toolSymbol)
  219.     add(gActorList, gCustomCursor)
  220.     set tool to toolSymbol
  221.     if tool = #camera then
  222.       clearHiddenActor(me)
  223.       add(gActorList, me)
  224.     end if
  225.   end if
  226.   flushBuffer()
  227. end
  228.  
  229. on activeAreaClick me
  230.   startBuffering()
  231.   if tool = #Tv then
  232.     TVhandler(me)
  233.   else
  234.     if tool = #camera then
  235.       cameraHandler(me)
  236.     else
  237.       runVTLanim(me)
  238.     end if
  239.   end if
  240.   flushBuffer()
  241. end
  242.  
  243. on runVTLanim me
  244.   set animData to getAt(animList, currentItem)
  245.   set frames to getAt(animData, 1)
  246.   set loops to getAt(animData, 2)
  247.   if count(animData) = 3 then
  248.     set reverseFlag to 1
  249.   end if
  250.   set baseCast to the castNum of sprite animChan
  251.   preLoadCast(baseCast + 1, baseCast + frames - 1)
  252.   repeat with loopCount = 1 to loops
  253.     repeat with offset = 0 to frames - 1
  254.       set the castNum of sprite animChan to baseCast + offset
  255.       updateStage()
  256.       startTimer()
  257.       repeat while the timer < 6
  258.       end repeat
  259.     end repeat
  260.     if reverseFlag then
  261.       repeat with offset = frames - 2 down to 0
  262.         set the castNum of sprite animChan to baseCast + offset
  263.         updateStage()
  264.         startTimer()
  265.         repeat while the timer < 6
  266.         end repeat
  267.       end repeat
  268.     end if
  269.   end repeat
  270. end
  271.  
  272. on TVhandler me
  273.   setAt(booleanList, currentItem, 1)
  274.   if getAt(booleanList, 9) = 1 then
  275.     set the enabled of gVTLgameObject to 1
  276.   end if
  277.   set videoName to getAt(videoList, currentItem)
  278.   set the videoName of gQTViewerObject to videoName
  279.   set paletteName to the name of cast (the number of cast videoName - 1)
  280.   set the paletteName of gQTViewerObject to paletteName
  281.   set the returnScript of gQTViewerObject to "returnFromQT( gVTLObject )"
  282.   cursor(-1)
  283.   set tool to #None
  284.   dispose(gCustomCursor)
  285.   removeSprite(48)
  286.   clearAllActors()
  287.   unpuppetAll()
  288.   puppetPalette("VTLpal")
  289.   go("Grass")
  290.   go(the frame + 1)
  291.   puppetPalette(paletteName, 60)
  292.   updateStage()
  293.   puppetPalette(0)
  294.   unLoadCast()
  295.   go("QT" & string(currentItem + 10))
  296. end
  297.  
  298. on cameraHandler me
  299.   puppetSound("camerashut2")
  300.   updateStage()
  301.   set toolData to getProp(toolList, #camera)
  302.   set toolButtonObject to getAt(toolData, 1)
  303.   resetBitmap(toolButtonObject)
  304.   set tool to #None
  305.   cursor(-1)
  306.   dispose(gCustomCursor)
  307.   removeSprite(48)
  308.   set the locH of sprite cropMarksChan to -1000
  309.   addPhoto(gAlbumObject, "VTL" & string(currentItem))
  310.   repeat while soundBusy(1)
  311.   end repeat
  312.   puppetSound(0)
  313.   showAllActors()
  314. end
  315.  
  316. on returnFromQT me
  317.   prepareToLeave(gQTViewerObject)
  318.   go("Grass")
  319.   unLoadCast()
  320.   go(the frame + 1)
  321.   puppetPalette("VTLpal", 60)
  322.   updateStage()
  323.   puppetPalette(0)
  324.   predraw(me)
  325.   go("VTL" & string(currentItem))
  326.   go(the frame + 1)
  327.   moveSign(me, #down)
  328.   setup(me)
  329.   drawHardHat(me)
  330.   abort()
  331. end
  332.  
  333. on scrollRight me
  334.   if objectp(gCustomCursor) then
  335.     resetTool(me)
  336.   else
  337.     if (currentItem < 9) and not objectp(gRollAnimButton) then
  338.       wasVideoSeen(me)
  339.       set currentItem to currentItem + 1
  340.       sayNumber(me, currentItem)
  341.       go(the frame + 1)
  342.       moveSign(me, #Up)
  343.       removeHardHat(me)
  344.       puppetTransition(51, 1)
  345.       updateStage()
  346.       repeat with x = 1 to 96
  347.         set the locH of sprite 7 to the locH of sprite 7 - 1
  348.         set the locH of sprite 8 to the locH of sprite 8 - 3
  349.         set the locH of sprite 9 to the locH of sprite 9 - 5
  350.         updateStage()
  351.       end repeat
  352.       puppetSound(0)
  353.       cursor(-1)
  354.       removeSprite(48)
  355.       go(label("VTL" & string(currentItem)) + 1)
  356.       puppetSound(getAt(nameSoundList, currentItem))
  357.       moveSign(me, #down)
  358.       if (currentItem = 9) and (the enabled of gVTLgameObject <> 1) then
  359.         set the enabled of gVTLgameObject to 1
  360.         showVTLgameButton(me)
  361.         drawHardHat(me)
  362.         repeat while soundBusy(1)
  363.         end repeat
  364.         puppetSound(0)
  365.         sound playFile 1, gCDpath & "SOUND" & gFileSep & "HELP" & gFileSep & gameIntroSound
  366.         repeat while soundBusy(1)
  367.         end repeat
  368.       else
  369.         drawHardHat(me)
  370.         repeat while soundBusy(1)
  371.         end repeat
  372.         puppetSound(0)
  373.       end if
  374.     end if
  375.   end if
  376. end
  377.  
  378. on moveSign me, direction
  379.   if direction = #Up then
  380.     repeat with delta in signPathList
  381.       set the locV of sprite signChan to the locV of sprite signChan - delta
  382.       moveSprite(me)
  383.     end repeat
  384.     puppetSprite(signChan, 0)
  385.   else
  386.     repeat with delta in signPathList
  387.       set the locV of sprite signChan to the locV of sprite signChan + delta
  388.       moveSprite(me)
  389.     end repeat
  390.     puppetSprite(signChan, 1)
  391.   end if
  392. end
  393.  
  394. on moveSprite me
  395.   updateStage()
  396.   startTimer()
  397.   repeat while the timer < 2
  398.   end repeat
  399. end
  400.  
  401. on scrollLeft me
  402.   if objectp(gCustomCursor) then
  403.     resetTool(me)
  404.   else
  405.     if (currentItem > 1) and not objectp(gRollAnimButton) then
  406.       wasVideoSeen(me)
  407.       set currentItem to currentItem - 1
  408.       sayNumber(me, currentItem)
  409.       go(the frame - 2)
  410.       moveSign(me, #Up)
  411.       removeHardHat(me)
  412.       puppetTransition(51, 1)
  413.       updateStage()
  414.       repeat with x = 1 to 96
  415.         set the locH of sprite 7 to the locH of sprite 7 + 1
  416.         set the locH of sprite 8 to the locH of sprite 8 + 3
  417.         set the locH of sprite 9 to the locH of sprite 9 + 5
  418.         updateStage()
  419.       end repeat
  420.       puppetSound(0)
  421.       cursor(-1)
  422.       removeSprite(48)
  423.       go(label("VTL" & string(currentItem)) + 1)
  424.       puppetSound(getAt(nameSoundList, currentItem))
  425.       moveSign(me, #down)
  426.       drawHardHat(me)
  427.       repeat while soundBusy(1)
  428.       end repeat
  429.       puppetSound(0)
  430.     end if
  431.   end if
  432. end
  433.  
  434. on wasVideoSeen me
  435. end
  436.  
  437. on goMenu me, buttonObject
  438.   set tool to #None
  439.   clearAllActors()
  440.   unpuppetAll()
  441.   makeButtonJump(buttonObject)
  442.   puppetPalette("VTLpal")
  443.   go("Grass")
  444.   go(the frame + 1)
  445.   unLoadCast()
  446.   goLocationMap()
  447. end
  448.  
  449. on help me, buttonObject
  450.   birth(script "Help Parent", buttonObject, #VTL)
  451. end
  452.